CXX = g++
CC = gcc
STRIP = strip

.PHONY: default  clean

TCP_SERVER = ./tcp_server
TCP_CLIENT = ./tcp_client
TARGET = $(TCP_SERVER) $(TCP_CLIENT) 
CFLAGS = -Wall
default: $(TARGET) 

HV_LD_PATH= ../libhv/build/lib
HV_LD_LIBS= -L$(HV_LD_PATH) -lhv
HV_INCLUDE_PATH=-I ../libhv/build/include/

INCLUDE = $(HV_INCLUDE_PATH)

LIBS = $(HV_LD_LIBS)

# OBJECTS += $(patsubst %.cpp, %.o, $(wildcard *.cpp))

$(TCP_SERVER): TcpServer_test.o 
	$(CXX) $(INCLUDE) $(CFLAGS) TcpServer_test.o  $(LIBS) -ldl -lpthread -o $(TCP_SERVER)
	$(STRIP) $(TCP_SERVER) 
	@ rm -rf TcpServer_test.o 

$(TCP_CLIENT): TcpClient_test.o 
	$(CXX) $(INCLUDE) $(CFLAGS) TcpClient_test.o  $(LIBS) -ldl -lpthread -o $(TCP_CLIENT)
	$(STRIP) $(TCP_CLIENT) 
	@ rm -rf TcpClient_test.o 
	
%.o:%.cpp
	$(CXX) $(CFLAGS) $(LDFLAGS) $(INCLUDE) -c $^ -o $@

clean:
	@ rm -rf $(TARGET)
